import java.util.Scanner;

public class pinwei {
    public static void main(String[] args) {
        int[] arr = new int[6];
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            Scanner sc = new Scanner(System.in);
            arr[i] = sc.nextInt();
            sum+=arr[i];
        }
        int max =arr[3];
        int min = arr[3];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] < min) {
                min = arr[i];
            }
        }
        System.out.println( sum=sum-max-min);

    }

}